/**
 * 支持的类型枚举
 */
var DataType;
(function (DataType) {
    DataType["Array"] = "Array";
    DataType["Boolean"] = "Boolean";
    DataType["String"] = "String";
    DataType["Number"] = "Number";
    DataType["Object"] = "Object";
    DataType["Function"] = "Function";
    DataType["AsyncFunction"] = "AsyncFunction";
    DataType["Map"] = "Map";
    DataType["Set"] = "Set";
    DataType["Symbol"] = "Symbol";
    DataType["Date"] = "Date";
    DataType["RegExp"] = "RegExp";
    DataType["Promise"] = "Promise";
    DataType["Null"] = "Null";
    DataType["Undefined"] = "Undefined";
    DataType["BigInt"] = "BigInt";
})(DataType || (DataType = {}));
/**
 * 获取值的具体类型
 * @param value - 要检查的值
 * @returns 返回类型字符串
 */
function getTypeof(value) {
    return Object.prototype.toString.call(value).slice(8, -1);
}
/**
 * 类型检查函数生成器
 * @param type - 要检查的类型
 * @returns 返回类型检查函数
 */
const createTypeChecker = (type) => (value) => getTypeof(value) === type;
// 基础类型检查函数
const isArray = Array.isArray;
const isBoolean = createTypeChecker(DataType.Boolean);
const isString = createTypeChecker(DataType.String);
const isNumber = (value) => createTypeChecker(DataType.Number)(value) && !isNaN(value);
const isObject = (value) => createTypeChecker(DataType.Object)(value) && value !== null;
const isFunction = (value) => createTypeChecker(DataType.Function)(value) ||
    createTypeChecker(DataType.AsyncFunction)(value);
const isMap = createTypeChecker(DataType.Map);
const isSet = createTypeChecker(DataType.Set);
const isSymbol = createTypeChecker(DataType.Symbol);
// 扩展类型检查函数
const isDate = createTypeChecker(DataType.Date);
const isRegExp = createTypeChecker(DataType.RegExp);
const isPromise = (value) => createTypeChecker(DataType.Promise)(value) ||
    (value instanceof Promise);
const isNull = createTypeChecker(DataType.Null);
const isUndefined = createTypeChecker(DataType.Undefined);
const isBigInt = createTypeChecker(DataType.BigInt);
/**
 * 检查值是否为原始类型
 */
const isPrimitive = (value) => value === null ||
    value === undefined ||
    isBoolean(value) ||
    isNumber(value) ||
    isString(value) ||
    isSymbol(value) ||
    isBigInt(value);
/**
 * 检查值是否为普通对象（不包括数组、Map等）
 */
const isPlainObject = (value) => {
    if (!isObject(value))
        return false;
    const proto = Object.getPrototypeOf(value);
    return proto === null || proto === Object.prototype;
};
/**
 * 获取值的详细类型信息
 */
const getTypeInfo = (value) => {
    const type = getTypeof(value);
    return {
        type,
        isPrimitive: isPrimitive(value),
        isNullable: value === null || value === undefined
    };
};

export { DataType, getTypeInfo, getTypeof, isArray, isBigInt, isBoolean, isDate, isFunction, isMap, isNull, isNumber, isObject, isPlainObject, isPrimitive, isPromise, isRegExp, isSet, isString, isSymbol, isUndefined };
